package com.justRun;

import com.justRun.R;

import android.content.Context;
import android.graphics.Typeface;
import android.view.Gravity;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;

public class ParcoursLayout  {
	private LinearLayout ln, ln1, ln2;
	private LinearLayout.LayoutParams param;
	private TextView txt1, txt2;
	private Typeface font ;
	
	public ParcoursLayout(Context context) {
		ln = new LinearLayout(context);
		ln2 = new LinearLayout(context);
		ln1 = new LinearLayout(context);
		param = new LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT, 2);
		createLayout(context);
	}
	
	private void createLayout(Context context){
		font = Typeface.createFromAsset(context.getAssets(), "JOKERMAN.ttf");
		
		ln.setBackgroundResource(R.drawable.fondlignepath);
		txt1 = new TextView(context);
		txt2 = new TextView(context);
		
		ln.setOrientation(LinearLayout.HORIZONTAL);
		ln.addView(ln1, param );
		ln.addView(ln2, param );
		
		ln1.setGravity(Gravity.CENTER);
		ln2.setGravity(Gravity.CENTER);
		
		ln1.addView(txt1);
		ln2.addView(txt2);
		
		txt1.setTextColor(0xffffffff);
		txt1.setTextSize(22);
		txt1.setTypeface(font);
		txt1.setAlpha(Float.parseFloat("0.9"));
		txt2.setTextColor(0xffffffff);
		txt2.setTextSize(15);
		txt2.setTypeface(font);
		txt2.setAlpha(Float.parseFloat("0.9"));
	}
	
	public LinearLayout getLayout(){
		return ln;
	}
	
	public void setLeftText (String str){
		txt1.setText(str);
	}
	
	public void setMiddleText (String str){
		txt2.setText(str);
	}
	
	public void onClick(OnClickListener l){
		ln.setOnClickListener(l);
	}
}
